/*
 * style.h
 *
 *  Created on: 03.07.2012
 *      Author: Caffeine
 */

#ifndef __STYLE_H__
#define __STYLE_H__


#include <lampe/xml/IFactoryRecord.h>
#include <lampe/xml/IXmlNode.h>

namespace lampe{
namespace xml{

class CXMLFactoryEnvironment;


class StyleFactoryRecord:public lampe::xml::IFactoryRecord{
private:
	struct style_rect{
		lampe::String name;
		lampe::String value;
		style_rect();
		style_rect(lampe::String n,lampe::String v);
		void addTo(lampe::xml::IXmlNode*node);
	};

	struct style_item{
		lampe::String name;
		LAMPE_VECTOR_VENDOR<style_rect> list;
		style_item(lampe::String n);
		void addTo(lampe::xml::IXmlNode*node);
		void setParent(style_item node);
		void add(lampe::String name,lampe::String value);
	};

	LAMPE_VECTOR_VENDOR<style_item> styles;

	lampe::s32 getStyleByName(lampe::String name);

public:

	void addStyleRecord(void*style,lampe::String name,lampe::String value);
	void addStyleRecord(lampe::String style,lampe::String name,lampe::String value);

	virtual LAMPE_VECTOR_VENDOR<String> getProcessedTags();
	virtual LAMPE_VECTOR_VENDOR<String> getProcessedAttributes();

	virtual lampe::xml::TagResult tagHandlerBefor(lampe::xml::IXMLFactoryEnvironment*environment,lampe::xml::IXmlNode*node);
	virtual lampe::xml::TagResult tagHandlerAfter(lampe::xml::IXMLFactoryEnvironment*environment,lampe::xml::IXmlNode*node);
	virtual lampe::xml::TagResult attributeHandler(lampe::xml::IXMLFactoryEnvironment*environment,lampe::xml::IXmlNode*node,lampe::u32 index);
};

}//namespace xml
}//namespace irr
void regStyle(lampe::xml::CXMLFactoryEnvironment*environment);

#endif /* STYLE_H_ */
